<template>
  <div class="sponsor">
    <div class="container">
      <tip></tip>
      <project_info></project_info>
    </div>
  </div>
</template>

<script>

import tip from './comps/tip/tip'
import Project_info from "./comps/project_info/project_info";
import { mapGetters } from 'vuex'
export default {
  components: {
    // 标题
    tip,
    // 项目信息
    Project_info
  },
  methods: {
    checkLogin() {
      if (!this.getIsLogin) {
        this.$Message.error('请先登录账号');
        this.$router.push('/front')
      }
    }
  },
  computed: {
    ...mapGetters(['getUserData','getIsLogin'])
  },
  watch: {
    getIsLogin(v1, v2) {
      this.checkLogin()
    }
  },
  created() {
    // 开始的时候，判断登录
    // this.checkLogin()
    this.$show.$emit('getLogin')
    // 会发射请求登录的要求
    this.$show.$on('getUserLoginSuccess', this.checkLogin)
  },
  beforeDestroy(){
    this.$show.$off('getUserLoginSuccess')
  }
}



</script>

<style>

</style>